<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserStudyPivotTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_study_pivot', function (Blueprint $table) {
            $table->integer('study_id')->comment('学习资料id');
            $table->integer('user_id')->comment('用户id');
            $table->integer('project_id')->comment('项目id');
            $table->tinyInteger('type')->comment('资料类型');
            $table->primary(['study_id','user_id']);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_study_pivot');
    }
}
